home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
e
/
misc.txt
/
000105_fdc@panix.com_Mon Jul 23 14:56:29 2007.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
3KB
Path: reader2.panix.com!panix!not-for-mail
From: Frank da Cruz <fdc@panix.com>
Newsgroups: comp.protocols.kermit.misc
Subject: Re: kermit script and unix arguments
Date: Mon, 23 Jul 2007 18:56:20 +0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Lines: 44
Message-ID: <slrnfa9uek.32e.fdc@panix2.panix.com>
References: <1184013722.056689.209050@r34g2000hsd.googlegroups.com> <JUyki.20761$Io4.15605@edtnps89>
Reply-To: fdc@columbia.edu
NNTP-Posting-Host: panix2.panix.com
X-Trace: reader2.panix.com 1185216980 24951 166.84.1.2 (23 Jul 2007 18:56:20 GMT)
X-Complaints-To: abuse@panix.com
NNTP-Posting-Date: Mon, 23 Jul 2007 18:56:20 +0000 (UTC)
User-Agent: slrn/0.9.8.0 (NetBSD)
Xref: panix comp.protocols.kermit.misc:15676
On 2007-07-09, Matthew Clarke <clamat@telus.net> wrote:
: mortier <mortier@locean-ipsl.upmc.fr> writes:
:
:>Hello,
:>
:>I want to use a kermit script starting with #!/usr/bin/kermit +
:>with a line of argument (which can be empty). How the check if there
:>are actually arguments ? In the case where there are arguement, how to
:>put then in local kermit variables? In fact, how to mimic with kermit
:>the linux
:>while getops "options here" option ; do ... ?
:>
:>Thanks a lot for help, Laurent
:
: According to "Using C-Kermit" (2nd edition), \v(args) holds the number of
: arguments and the array \&@[] holds the arguments themselves.
:
: See http://www.columbia.edu/kermit/scriptlib.html for example scripts,
: many of which have code to parse command-line arguments.
:
Actually the appropriate array is \&_[] and the appropriate count is \v(argc).
The \&@[] array contains *all* the command-line arguments -- command-line
options for Kermit as well as arguments for the script. When you write a
kerbang script, normally you would only want the script to process the
arguments that are for the script itself. And as expected the \&_[0] element
contains the name of the script, rather than the name of Kermit. For details
see:
http://www.columbia.edu/kermit/ckermit70.html#x7.19 (kerbang scripts)
and:
http://www.columbia.edu/kermit/ckermit70.html#x7.19 (passing arguments)
and:
http://www.columbia.edu/kermit/ckermit70.html#x7.5 (using > 10 arguments)
Note that \&_[1] through \&_[9] are the same as \%1 through \%9 -- i.e. the
regular macro / command-file arguments. The array is useful for accessing
the arguments programmatically by number, and also allows for more than 9
arguments.
- Frank